Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Load Script

The Load Script command loads a compiled script into the current script as a script object. A script object is a user-defined object that is treated as a value
by AppleScript. Script objects are described in Chapter 9, "Script Objects,"
of the AppleScript Language Guide.

Load Script is the only command provided by the Load Script scripting addition.

SYNTAX
load script referenceToFile
PARAMETER
referenceToFile
A reference of the form file nameString or alias nameString (see "Notes"). The file must be a compiled script file or a script application file. It cannot be a text file.
Class: Reference
RESULT
A script object.

EXAMPLES
The following example loads a compiled script called Numeric Operations and stores the resulting script object in the variable NumericLib. The Tell statement shows how to call a subroutine contained in the script object.

load script file "MacHD:Scripts:Numeric Operations"set NumericLib to result

tell NumericLib
   factorial(10)
end tell
NOTES
To specify the name (nameString) of a file, use a string of the form "Disk:Folder1:
Folder2:...:Filename"
as described in Chapter 5, "Objects and References,"
of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript attempts to find the file in the current directory.

For more information about using Load Script to save and load libraries of subroutines for use in multiple scripts, see Chapter 8, "Handlers," of the AppleScript Language Guide.

ERRORS
Error
number
Error message
-108Out of memory.
-192Bad name for file.
-1700Can't make some data into the expected type.
-1701Some parameter is missing for <commandName>.
-1703Some data was the wrong type.
-1704Some parameter was invalid.
-1705Operation involving a list item failed.
-1718Reply has not yet arrived.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996